<?php if(Yii::app()->user->getState('avatar')) : ?>
    <img src="/images/uploads/userAvatars/<?php echo Yii::app()->user->getState('avatar'); ?>" style="width:45px"/>
<?php else : ?>
    <img src="/images/prettyImg/default-avatarl.jpg" width="45px"/>
<?php endif; ?>
    <span style="color: #942a25; font-size: 45px;"><?php echo Yii::app()->user->getState('displayName'); ?></span>
    <div style="color: gray"><?php echo Yii::app()->dateFormatter->format("dd MMMM yyyy года в HH:mm", Yii::app()->user->getState('logDate')); ?></div>
<?php $this->renderPartial('//partials/userMenu', array('countNewComments'=>$this->countNewComments['count'], 'countNewMessages'=>$this->countNewMessages['count'])); ?>

<div>
<ul class="unstyled message_menu ">
    <li  ><a href="<?php echo Yii::app()->createUrl('user/messages/messages'); ?>">Входящие</a></li>
    <li><a href="<?php echo Yii::app()->createUrl('user/messages/outbox'); ?>">Отправленные</a></li>
    <li class="selected"><a  href="<?php echo Yii::app()->createUrl('user/messages/capt'); ?>">Корзина</a></li>
</ul>
</div>    
<div class="clearfix"></div>
<div style="margin-bottom: 20px;height: 20px;margin-top: 15px;">
    <?php if(count($dialogs)) : ?>
        <span class="pull-right mes_numbers"><?php echo count($dialogs); ?> из <?php echo $pagination->getItemCount(); ?> сообщений</span>
    <?php endif; ?>
</div>
<?php if(isset($dialogs) && !empty($dialogs)) : ?>
    <?php foreach ($dialogs as $item) : ?>

        <div class="messItem">
            <?php if($item['userFrom']['avatar']) : ?>
                <img src="/images/uploads/userAvatars/<?php echo $item['userFrom']['avatar']; ?>" style="width:45px"/>
            <?php else : ?>
                <img src="/images/prettyImg/default-avatarl.jpg" width="45px"/>
            <?php endif; ?>

            <a style="color: #942a25; font-size: 45px;" href="<?php echo Yii::app()->createUrl('user/profile/profile', array('login'=>$item['userFrom']['login'])); ?>"><?php echo $item['userFrom']['displayName']; ?></a>
            <br/><?php echo Yii::app()->dateFormatter->format("dd MMMM yyyy в HH:mm", $item['sendDate']); ?><br/>

            <?php if(mb_strlen($item['message'], 'utf-8') > 200) : ?>
              <?php $message = CPartnerkiHelper::getShortText($item['message'], 200).'...'; ?>
            <?php else : ?>    
              <?php $message = $item['message']; ?>  
            <?php endif; ?>
            
            <a style="color:#000" href="<?php echo Yii::app()->createUrl('user/messages/dialog', array('fromId'=>$item['fromId'], 'toId'=>$item['toId'])); ?>"><?php echo $message; ?></a>  
            
            <div>
                <?php echo CHtml::link('Восстановить переписку', array('messages/renewDialog', 'dialogId'=>$item['dialogId'])); ?>
            </div>
        </div>
    <hr/>
    <?php endforeach; ?>
<?php else : ?>    
    Корзина пуста.
<?php endif; ?>